/*
 * Copyright (c)  2015~2020, xforceplus
 * All rights reserved.
 * Project:datacare-orm
 * Id: TestColNullFunction.java   2020-10-10 21-36-48
 * Author: Evan
 */
package cn.datacare.orm.engine.function;

import org.beetl.core.Context;
import org.beetl.core.Function;

import static cn.datacare.orm.util.Separator.COMMA;
import static cn.datacare.orm.util.StringUtils.EMPTY;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: 2015~2020
 * </p>
 * <p>
 * Company/Department: xforceplus
 * </p>
 *
 * @author Evan
 * <b>Creation Time:</b> 2020-10-10 21-36-48
 * @since V1.0
 */
public class TestColNullFunction implements Function {

    /**
     * @param paras beetl传递的参数
     * @param ctx
     * @return
     */
    @Override
    public Object call(Object[] paras, Context ctx) {
        Object arg = paras[0];
        String paramName = (String) paras[1];
        return arg == null ? EMPTY : paramName + COMMA;
    }
}
